home *** CD-ROM | disk | FTP | other *** search
/ The Programmer Disk / The Programmer Disk (Microforum).iso / xpro / pascal / pro11 / testansi.pas < prev   
Pascal/Delphi Source File  |  1985-11-01  |  2KB  |  61 lines

  1. program ANSITest;
  2.  
  3. (****************************************************************)
  4. (*                                                              *)
  5. (*  SOURCE MODULE: test ANSI device driver                      *)
  6. (*                 TURBO PASCAL                                 *)
  7. (*  MOD LEVEL:     1.00                                         *)
  8. (*  REQUIREMENTS:  CONFIG.SYS contains 'DEVICE=ANSI.SYS'        *)
  9. (*                 and ANSI.SYS driver installed.               *)
  10. (****************************************************************)
  11.  
  12. Type
  13.   ANSIStr = String [ 255 ];
  14. Var
  15.   Fileid : Text;
  16.   InputField : ANSIStr;
  17.  
  18. procedure WriteANSI( Str : ANSIStr) ;
  19.  
  20. Var
  21.   Regs: Record
  22.           Case Integer of
  23.             1: ( Ax, Bx, Cx, Dx, Bp, Di, Si, Ds, Es, Flags : Integer);
  24.             2: ( Al, Ah, Bl, Bh, Cl, Ch, Dl, Dh : Byte);
  25.           end;
  26.   i : integer;
  27. begin  {  WriteANSI  }
  28. {test
  29.   Writeln( lst, 'The length of the string is : ', Length( Str ) );
  30.   Write( lst, ' It contains : ' );
  31.   for i := 1 to Length( Str )  do  Write( lst, Ord( Str [ i ] ) : 4 );
  32.   Writeln( lst );
  33.      }
  34.  
  35.   With Regs do begin
  36.     bx := 1;              { file handle.  1 = Standard Screen Output }
  37.     cx := Length( Str );
  38.     ds := Seg( Str );
  39.     dx := Ofs( Str ) + 1; { address of actual ascii string }
  40.     ah := $40;
  41.   end;
  42.  
  43.   MsDos( Regs );
  44. end;   {  WriteANSI  }
  45.  
  46.  
  47. begin  {  program  }
  48. (*
  49.   WriteANSI( Chr(27) + '[33;44m' );
  50.   WriteANSI( 'This is a test of the ANSI Device Driver' );
  51. *)
  52.   Assign( Fileid, 'asm00001');
  53.   Reset( Fileid );
  54.   While Not Eof( Fileid ) do begin
  55.     Readln( Fileid, InputField );
  56.     WriteANSI( InputField );
  57.   end;
  58.   Close( Fileid );
  59.   Read;
  60. end.   {  program  }
  61.